import javax.swing.*;
import java.awt.*;

import java.awt.image.BufferStrategy;

class Test extends JFrame {

    PBDisplay display;

    BufferStrategy strategy;

    public static void main(String[]args) {
	Test Client = new Test();
    }

    Test() {
	setSize(800,600);
	setVisible(true);
	setResizable(false);

	createBufferStrategy(2);
	strategy = getBufferStrategy();

	display = new PBDisplay();
	getContentPane().add(display);
    }

    class PBDisplay extends JPanel {
	PBDisplay () {
	    setBackground(Color.BLACK);
	    setSize(640,480);
	    setLocation(50,50);
	    setVisible(true);

	    while (true) {
		Graphics2D g = (Graphics2D) strategy.getDrawGraphics();
		g.setColor(Color.black);
		g.fillRect(0,0,getWidth(),getHeight());
		g.dispose();
		strategy.show();

		try {
		    Thread.sleep(1000);
		} catch (Exception e) {}

	    }
	}
    }
}
